<%@ page language="java" contentType="text/html; charset=UTF-8"%>
<%@ include file="/include/taglibs.jsp"%>
<head>
<style type="text/css" media="screen">
/* You don't need these, they are here to tune up the page */
html {
	color: #343434;
	background: #bcc2c6 url(bg.png);
	font-size: 14px;
	line-height: 1.5;
	font-family: "Lucida Sans Unicode", "Lucida Grande", Arial, Verdana,
		sans-serif;
}

body {
	
}
a:link,a:visited {
	text-decoration: none;
	color: #254a86;
}

a:hover,a:focus {
	text-decoration: underline;
}

h1,h2,h3,ul,ol,p {
	margin: 1.5em 0;
}

h1 {
	margin: 42px auto 28px auto;
	width: 284px;
}

h2 {
	font-size: 1.25em;
}

.uniForm h2 {
	margin: 1em 0 1em 1.15em;
}

fieldset h3 {
	margin: 1.5em -28px;
	padding: 14px 28px;
	line-height: 1;
	background: #efefef;
	color: #343434;
}

.uniForm {
	width: 55%;
	background: #fff;
	margin: 28px auto;
	padding: 28px;
	/* CSS3 */
	border-radius: 12px;
	-webkit-border-radius: 12px;
	-moz-border-radius: 12px;
	-o-border-radius: 12px;
	-khtml-border-radius: 12px;
}

.header {
	margin: -28px -28px 28px -28px;
	padding: 1px 28px;
	background: #efefef;
	border-bottom: 1px solid #dfdfdf;
	position: relative;
	/* CSS3 */
	border-top-left-radius: 10px;
	border-top-right-radius: 10px;
	-webkit-border-top-left-radius: 10px;
	-webkit-border-top-right-radius: 10px;
	-moz-border-radius-topleft: 10px;
	-moz-border-radius-topright: 10px;
}

.header h2 {
	margin: 1.5em 0 0 0;
	color: #343434;
	color: #777;
}

.header p {
	margin-top: 0;
	font-size: 12px;
	color: #777;
}

.header .cta {
	position: absolute;
	bottom: 26px;
	right: 28px;
	text-align: right;
	font-weight: bold;
	background: #194789;
	padding: 7px 14px;
	/* CSS3 */
	border-radius: 4px;
	-webkit-border-radius: 4px;
	-moz-border-radius: 4px;
	-o-border-radius: 4px;
	-khtml-border-radius: 4px;
	text-shadow: -1px -1px 0 rgba(0, 0, 0, .25);
}

.header .cta:link,.header .cta:visited {
	color: #fff;
}

.header .cta:focus,.header .cta:hover {
	text-decoration: none;
	/* CSS3 */
	box-shadow: 0 0 9px rgba(0, 163, 255, 1);
	-webkit-box-shadow: 0 0 9px rgba(0, 163, 255, 1);
	-moz-box-shadow: 0 0 9px rgba(0, 163, 255, 1);
}

.header .cta:active {
	bottom: 25px;
}

/* IE6 fixes for the page */
* html form.uniForm {
	overflow: hidden;
}

* html .header {
	zoom: 1;
	overflow: hidden;
}
</style>

<!--[if lte ie 7]>
      <style type="text/css" media="screen">
        /* Move these to your IE6/7 specific stylesheet if possible */
        .uniForm, .uniForm fieldset, .uniForm .ctrlHolder, .uniForm .formHint, .uniForm .buttonHolder, .uniForm .ctrlHolder ul{ zoom:1; }
      </style>
<![endif]-->

<script type="text/javascript">
	/*function checkPassword(obj,target){
		if(obj.value!=target.value){
			alert(obj.alt+'和'+target.alt+'的值不同');
			return false;
		}		
		return true;
	}*/
	
	$(document).ready(function() {
			
			$("#uniForm").validationEngine()
		});
</script>
</head>


<style type="text/css">
.input-space .line {
	width: 480px;
	height: 24px;
}

.input-space .value {
	width: 360px;
}
</style>

<body>
<form id="frminput" class="uniForm" method="post" action="ne.robotmanagemodify.do?method=modifyRobot" id="uniForm">
<input name="idRobot" id="idRobot" size="35" maxlength="50" type="hidden" class="textInput small" value="${RA_ROBOT.idRobot}"/>
<div class="header">
<h2>设备管理--修改</h2>
<p></p>
</div>
<fieldset>
<h3>基本信息</h3>
<div class="ctrlHolder"><label for=""><em>*</em>name</label>		
<input name="name" id="name" size="35" maxlength="50" type="text" class="validate[required,length[0,20]] textInput small" value="${RA_ROBOT.name}"/>
</div>
<div class="ctrlHolder"><label for=""><em>*</em> <bean:message
	key="ne.robot.channel" bundle="ne" /></label> 
	<input name="channel" id="channel" size="35" maxlength="50" type="text" class="validate[required,length[0,20],custom[onlyNumber]] textInput small" value="${RA_ROBOT.channel}"/>
</div>
<div class="ctrlHolder"><label for=""><em>*</em> <bean:message
	key="ne.robot.regionname" bundle="ne" /></label>
<div>
<div><select name="region" id="region"
	style="width: 185px; height: 24px;" class="validate[required] selectInput" onChange="doAutoSelect('regionId',this.value,'subregion');">
	<option value="">请选择顶级区域...</option>
	<c:forEach items="${RA_ROOT_REGIONS}" var="region">
		<option value="${region.idRegion}">${region.regionName}</option>
    </c:forEach>
</select>

<select name="subregion" id="subregion"
	style="width: 185px; height: 24px;" class="validate[required] selectInput">
	<option value="">请选择子级区域...</option>
	<c:forEach items="${RA_SUB_REGIONS}" var="region">
		<option value="${region.idRegion}">${region.regionName}</option>
	</c:forEach>
</select></div>
</div>
</div>
</fieldset>
<div class="buttonHolder">
<button type="button" class="secondaryAction"  onclick="javascript:window.history.back();">← Cancel and go
back</button>
<button type="submit" class="primaryAction">确&nbsp;定</button>
</div>
</form>

<script type="text/javascript">
 var type;
 var targetId;
 function doAutoSelect(typeTemp,keyValue,targetTemp) {    
	type=typeTemp;
	targetId=targetTemp;
      var url = "<c:url value='/common.regionAutoSelect.do?keyValue="+keyValue+"&type="+type+"'/>";
     　　if (window.XMLHttpRequest) {
             　　  req = new XMLHttpRequest();
     　　}else if (window.ActiveXObject) {
             　　req = new ActiveXObject("Microsoft.XMLHTTP");
     　　}
     　 if(req){
             　req.open("GET",url, true);
             　　req.onreadystatechange = complete;
             　　req.send(null);
     　　}
 }
 
 function complete(){
     　　if (req.readyState == 4) {
             　　if (req.status == 200) {
	             if(type=="regionId"){
	            	  var strLink = req.responseXML.getElementsByTagName("subregion");
         	    	  var key=new Array();
         	    	  var value=new Array();
                      for(var i=0;i<strLink.length;i++){                      	                    	
                          key[i]=strLink[i].firstChild.data.split(",")[0];                                                
                          value[i]=strLink[i].firstChild.data.split(",")[1];                            
                     　　}                     
                     buildSelect(key,value,document.getElementById(targetId));   
         	     }
         	  }
     　　}
 }
 
function buildSelect(key,value,sel) {
     　　	sel.options.length=0;
		sel.options[sel.options.length]=new Option("请选择...","");
     　　	for(var i=0;i<key.length;i++) {     	
             　　sel.options[sel.options.length]=new Option(value[i],key[i]);
     　　	}
}
	
selectOption('subregion','${RA_ROBOT.regionManageOBJ.idRegion}');	

</script>
</body>
